//
//  UtilsMacros.h
//  ZhongJiao
//
//  Created by 刘明 on 16/9/2.
//  Copyright © 2016年 刘明. All rights reserved.
//

#ifndef UtilsMacros_h
#define UtilsMacros_h

// 日志输出
#ifdef DEBUG
#define LMLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
#else
#define LMLog(...)
#endif

#define LMWeakSelf(type)  __weak typeof(type) weak##type = type;
#define LMStrongSelf(type)  __strong typeof(type) type = weak##type;




#define k_eighty_two (IS_IPHONE_6PLUS?(82*1.5):82)
#define k_sixty (IS_IPHONE_6PLUS?(60*1.5):60)
#define k_fifty (IS_IPHONE_6PLUS?(50*1.5):50)
#define k_forty_four 44
#define k_thirty_eight (IS_IPHONE_6PLUS?(38*1.5):38)
#define k_thirty (IS_IPHONE_6PLUS?(30*1.5):30)
#define k_twenty (IS_IPHONE_6PLUS?(20*1.5):20)
#define k_fifteen (IS_IPHONE_6PLUS?(15*1.5):15)
#define k_ten (IS_IPHONE_6PLUS?(10*1.5):10)
#define k_five (IS_IPHONE_6PLUS?(5*1.5):5)
#define k_twenty_five (IS_IPHONE_6PLUS?(25*1.5):25)
#define k_hundred (IS_IPHONE_6PLUS?(100*1.5):100)
#define k_hundred_twenty (IS_IPHONE_6PLUS?(120*1.5):120)






#pragma mark - 颜色
#define LMWhiteColor [UIColor whiteColor]
#define LMBlackColor [UIColor blackColor]
#define LMDarkGrayColor [UIColor darkGrayColor]
#define LMLightGrayColor [UIColor lightGrayColor]
#define LMGrayColor [UIColor grayColor]
#define LMRedColor [UIColor redColor]
#define LMGreenColor [UIColor greenColor]
#define LMBlueColor [UIColor blueColor]
#define LMCyanColor [UIColor cyanColor]
#define LMYellowColor [UIColor yellowColor]
#define LMMagentaColor [UIColor magentaColor]
#define LMOrangeColor [UIColor orangeColor]
#define LMPurpleColor [UIColor purpleColor]
#define LMBrownColor [UIColor brownColor]
#define LMClearColor [UIColor clearColor]

//16进制

#define kUIColorFromRGB(rgbValue) [UIColor \
colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \
green:((float)((rgbValue & 0xFF00) >> 8))/255.0 \
blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]

//RGB
#define LMRGBAColor(r,g,b,a) [UIColor colorWithRed:r/255.0f green:g/255.0f blue:b/255.0f alpha:a]
#define LMRGBColor(r,g,b) LMRGBAColor(r,g,b,1.0f)
#define LMSeperatorColor LMRGBColor(234,237,240)
#define LMBgColor LMRGBColor(243,245,247)


#define LMRGBAFLOATColor(r,g,b,a) [UIColor colorWithRed:r green:g blue:b alpha:a]
#define LMRGBFLOATColor(r,g,b) LMRGBAFLOATColor(r,g,b,1.0f)


#define S_Color_98 [UIColor colorWithRed:98/255.0f green:209/255.0f blue:226/255.0f alpha:1]//浅绿
#define S_Color_153 [UIColor colorWithRed:169/255.0f green:169/255.0f blue:169/255.0f alpha:1]//浅灰
#define S_Color_205 [UIColor colorWithRed:150/255.0f green:150/255.0f blue:150/255.0f alpha:1]//浅浅灰
#define S_Color_102 [UIColor colorWithRed:121/255.0f green:121/255.0f blue:121/255.0f alpha:1]//浅黑
#define S_Color_239239 [UIColor colorWithRed:239/255.0f green:239/255.0f blue:244/255.0f alpha:1]

#define S_Color_51 [UIColor colorWithRed:66/255.0f green:66/255.0f blue:66/255.0f alpha:1]//黑
#define S_Color_239 [UIColor colorWithRed:239/255.0f green:172/255.0f blue:28/255.0f alpha:1]//橙黄
#define S_Color_240 [UIColor colorWithRed:240/255.0f green:240/255.0f blue:245/255.0f alpha:1]//白灰


#define LMNavigationBarTintColor [UIColor colorWithRed:98/255.0f green:209/255.0f blue:226/255.0f alpha:1]
#define LMNavigationTittleColor LMRGBColor(245,245,245)
#define LMNavigationItemTintColor LMRGBColor(245,245,245)

#define LMVersion [NSString stringWithFormat:@"%@",[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"]]

//System version utils

#define SYSTEM_VERSION_EQUAL_TO(v)                  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)
#define SYSTEM_VERSION_GREATER_THAN(v)              ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v)  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN(v)                 ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v)     ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)

//大于等于7.0的ios版本
#define iOS7_OR_LATER SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0")

//大于等于8.0的ios版本
#define iOS8_OR_LATER SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0")

//iOS6时，导航VC中view的起始高度
#define YH_HEIGHT (iOS7_OR_LATER ? 64:0)

//获取系统时间戳
#define getCurentTime [NSString stringWithFormat:@"%ld", (long)[[NSDate date] timeIntervalSince1970]]

#define kWindow [UIApplication sharedApplication].keyWindow    //主窗口
#define kUserDefault [NSUserDefaults standardUserDefaults]

#pragma mark - 字符串转化
#define LMEmptyStr @""
#define LMIntToStr(i) [NSString stringWithFormat: @"%d", i]
#define LMIntegerToStr(i) [NSString stringWithFormat: @"%ld", i]
#define LMValidStr(str) [NHUtils validString:str]


#endif /* UtilsMacros_h */
